package com.tao.YanMoDesignPattern.composite.case1_shopClothes;


/**
 * @Author Mi_Tao
 * @Date 2023/8/27
 * @Description
 * @Version 1.0
 **/
public class Client
 {

    public static void main(String[] args){
        // 定义多个Composite对象
        Composite root = new Composite("服装");
        Composite c1 = new Composite("男装");
        Composite c2 = new Composite("女装");
        // 定义多个Leaf对象
        Component leaf1 = new Leaf("衬衣");
        Component leaf2 = new Leaf("夹克");
        Component leaf3 = new Leaf("裙子");
        Component leaf4 = new Leaf("套装");

        // 按照树的结构来组合对象
        root.addChild(c1);
        root.addChild(c2);
        c1.addChild(leaf1);
        c1.addChild(leaf2);
        c2.addChild(leaf3);
        c2.addChild(leaf4);


        // 操作Component 对象
        root.printStruct("");

    }
}
